package com.foreknow.demo4;

import javax.sound.midi.Soundbank;

public class Traning {
    public static void main(String[] args) {
        int[] arrayList = {2,4,6,1,3,5};
        int[] sumList = Traning.sum(arrayList);
        for (int i =0 ;i < sumList.length;i++){
            System.out.print(sumList[i] + " ");
        }

    }
    public static int[] sum(int[] array){
//        int sum1 = 0;
//        int sum2 = 0;
//        int sum3 = 0;
        int[] sumList = new int[3];
        for (int i = 0; i < array.length;i++){
            if (array[i]%2 == 0){
//                sum1+=array[i];
                sumList[0]+=array[i];
            }else if (array[i]%2 != 0){
//                sum2+=array[i];
                sumList[1]+=array[i];
            }
            sumList[2]+=array[i];
        }
//        int[] sumList = {sum1,sum2,sum3};
        return  sumList;
    }
}
